from sanic import response
from sanic.handlers import ErrorHandler

from utils import result_util


# app error handler 全局异常处理
class AppErrorHandler(ErrorHandler):

    # 处理所有异常
    def default(self, request, exception):
        return response.json(result_util.error(500, str(exception)))
